open(BUFF,"gunzip -c ../beagle.r2.gz |") or die "no file beagle.r2.gz found\n";
while(<BUFF>)
{
	chomp($_);
	@a=split(" ",$_);
	$impute_r2{$a[0]}=$a[4];
}
open(BUFF,"/data4/bsi/bioinf_int/s106381.borawork/OV/EM_11_14_2012/emerge/snpQualityAndImputedInd.txt") or die "no file  snpQualityAndImputedInd.txt found\n";
while(<BUFF>)
{
        chomp($_);
        @a=split(" ",$_);
        $beagle_r2{$a[0]}=$a[1];
}
open(BUFF,"gunzip -c /data4/bsi/refdata/genetics/1000Genomes/downloaded_data/release/20110521/impute/ALL_1000G_phase1integrated_feb2012_impute/ALL_1000G_phase1integrated_feb2012_chr8_impute.legend.gz|") or die "no file found\n";

open(BUFF1,"compare_hapmap_impute.txt") or die "no file found compare_hapmap_impute.txt\n";
$line=<BUFF1>;
chomp($line);
print "$line ";
$line=<BUFF>;
chomp($line);
print $line." IMPUTATIONR2 BEAGLER2\n";
while(<BUFF>)
{
	chomp($_);
	@a=split(" ",$_);
	$hash{$a[0]} =$_;
}
while(<BUFF1>)
{
	chomp($_);
        @a=split(" ",$_);
	if(exists($hash{$a[0]}))
	{
		print $_." $hash{$a[0]} $impute_r2{$a[0]} $beagle_r2{$a[0]}\n";
	}
}
